package com.lanhu.designpattern.strategy.count;

/**
 * author:zhangzg
 * date:2020/11/9 16:15
 * 创建策略使用对象
 */
public class Context {
    //持有抽象的策略对象,利用多态向上转型
    private Strategy strategy;

    public Context(Strategy strategy) {
        this.strategy = strategy;
    }

    public int execute(int num1, int num2){
        return strategy.doOperate(num1, num2);
    }
}
